<?php
function create_seat ($iNumber, $iSeatInRow, $iAttribute = '', $iTop = '-103', $iHeight = '19', $iWidth = '19')
{
	global $iLeft;
	$iStandard = 17;
	$iLeft = $iStandard - $iSeatInRow;
	$sSQL = "SELECT tafelnr, nickname FROM `inschrijven` WHERE `tafelnr` = '" . $iNumber . "'";
	$sQuery = mysql_query ($sSQL);
	$a_mResult = mysql_fetch_assoc($sQuery);
	if ($iNumber == $a_mResult['tafelnr'])
	{
		$sDiv = '<div id="' . $iNumber . ': ' . $a_mResult['nickname'] . ' (Bezet)" class="tooltip" style="position: relative; top: ' . $iTop . 'px; left: ' . $iLeft . 'px; height: ' . $iHeight . 'px; width: ' . $iWidth . 'px; float: left; border: 1px solid #FFFFFF; text-align: center; color: #FFFFFF; background-color: #FF0000;' . $iAttribute . '">' . $iNumber . '</div>' . "\n";
	}
	else
	{
		$sDiv = '<div id="' . $iNumber . ': Vrij" class="tooltip" style="position: relative; top: ' . $iTop . 'px; left: ' . $iLeft . 'px; height: ' . $iHeight . 'px; width: ' . $iWidth . 'px; float: left; border: 1px solid #FFFFFF; text-align: center; color: #FFFFFF; background-color: #00FF00;' . $iAttribute . '">' . $iNumber . '</div>' . "\n";	
	}
	echo $sDiv;
}

function create_empty_place ($iSeatInRow, $iAttribute = '', $iTop = '-103', $iHeight = '19', $iWidth = '19')
{
	global $iLeft;
	$iStandard = 18;
	$iLeft = $iStandard - $iSeatInRow;
	$sDiv = '<div style="position: relative; top: ' . $iTop . 'px; left: ' . $iLeft . 'px; height: ' . $iHeight . 'px; width: ' . $iWidth . 'px; float: left; border: 1px solid transparent;' . $iAttribute . '"></div>' . "\n";
	echo $sDiv;
}
?>
<script type="text/javascript" src="/x/jquery/tooltip.jquery.js"></script>
<script type="text/javascript">
$(function()
{
	$('.tooltip').tooltip(
	{
		cursor : 'default',
		bgcolor : '#FFFFFF',
		fontcolor: '#000000',
		bordercolor : '#808080'
	});
});
</script>
<div style="background-image: url('/modules/seatmap/images/achtergrond.png'); background-repeat: no-repeat; height: 528px; width: 526px;">
&nbsp;
<?php
//row 1
create_empty_place	( 1, ' clear: left;');
create_empty_place	( 2);
create_empty_place	( 3);
create_empty_place	( 4);
create_empty_place	( 5);
create_empty_place	( 6);
create_empty_place	( 7);
create_empty_place	( 8);
create_empty_place	( 9);
create_empty_place	(10);
create_seat	 (10, 11);
echo "\n";
//row 2
create_empty_place	( 1, ' clear: left;');
create_empty_place	( 2);
create_empty_place	( 3);
create_empty_place	( 4);
create_empty_place	( 5);
create_empty_place	( 6);
create_empty_place	( 7);
create_empty_place	( 8);
create_empty_place	( 9);
create_empty_place	(10);
create_seat     (11, 11);
echo "\n";
//row 3
create_empty_place	( 1, ' clear: left;');
create_empty_place	( 2);
create_empty_place	( 3);
create_seat 	  (3, 4);
create_empty_place  ( 5);
create_empty_place	( 6);
create_empty_place	( 7);
create_empty_place	( 8);
create_empty_place	( 9);
create_empty_place	(10);
create_seat 	 (12, 11);
echo "\n";
//row 4
create_empty_place	( 1, ' clear: left;');
create_empty_place	( 2);
create_empty_place	( 3);
create_seat 	   (4, 4);
create_empty_place 	( 5);
create_empty_place	( 6);
create_empty_place	( 7);
create_empty_place	( 8);
create_empty_place	( 9);
create_empty_place	(10);
create_seat 	 (13, 11);
echo "\n";
//row 5
create_seat		(1, -3, ' clear: left;');
create_empty_place 	 ( 2);
create_empty_place 	 ( 3);
create_seat 	    (5, 4);
create_empty_place   ( 5);
create_empty_place	 ( 6);
create_empty_place	 ( 7);
create_empty_place	 ( 8);
create_empty_place	 ( 9);
create_empty_place	 (10);
create_seat 	 (14, 11);
echo "\n";
//row 6
create_seat		    (2, -3, ' clear: left;');
create_empty_place	  ( 2);
create_empty_place	  ( 3);
create_empty_place    ( 4);
create_seat 	    (6, 5);
create_empty_place	  ( 6);
create_empty_place	  ( 7);
create_empty_place	  ( 8);
create_empty_place	  ( 9);
create_empty_place	  (10);
create_seat 	  (15, 11);
create_empty_place	  (12);
create_empty_place	  (13);
create_empty_place	  (14);
create_seat 	  (16, 19);
echo "\n";
//row 7
create_empty_place    ( 1, ' clear: left;');
create_empty_place	  ( 2);
create_empty_place	  ( 3);
create_empty_place    ( 4);
create_empty_place	  ( 5);
create_seat	  	    (7, 6);
create_seat	  	    (8, 7);
create_seat		    (9, 8);
create_empty_place	  ( 9);
create_empty_place	  (10);
create_empty_place 	  (11);
create_empty_place 	  (12);
create_empty_place	  (13);
create_empty_place	  (14);
create_seat 	  (17, 19);
?>
</div>
